import requests from '../common/request'

export function getCouponList(data) {
  return requests.get({
    url: '/memberApp/coupon/list',
    data: data
  })
}
export function getCouponDetail(data) {
  return requests.get({
    url: '/memberApp/coupon/detail',
    data: data
  })
}
export function getCouponStatus(data) {
  return requests.get({
    url: '/memberApp/coupon/couponStatus',
    data: data
  })
}
export function getCouponReceiveCode(data) {
  return requests.post({
    url: '/memberApp/couponGive/receiveCode?couponCode=' + data.couponCode
  })
}

export function getCouponReceivePage(data) {
  return requests.get({
    url: '/memberApp/couponGive/receivePage',
    data: data
  })
}

// 领取用户转赠的券
export function receiveCoupon(data) {
  return requests.post({
    url: '/memberApp/couponGive/receive?receiveCode=' + data.receiveCode
  })
}


export function confirmGive(data) {
  return requests.post({
    url: '/memberApp/couponGive/confirmGive?receiveCode=' + data.receiveCode
  })
}
export function cancelGive(data) {
  return requests.post({
    url: '/memberApp/couponGive/cancel?couponCode=' + data.couponCode
  })
}

export function getCouponSyncConfig(data) {
  return requests.get({
    url: '/memberApp/coupon/syncConfig',
    data: data
  })
}



export function getCouponAllShopList(data) {
  return requests.get({
    url: '/memberApp/coupon/all_shop_list',
    data: data
  })
}

export function getCouponAvailableShopList(data) {
  return requests.get({
    url: '/memberApp/coupon/available_shop_list',
    data: data
  })
}
export function getReceivePageInfo(data) {
  return requests.get({
    url: '/memberApp/coupon/receivePageInfo',
    data: data
  })
}
// 领取商家优惠券
export function receiveBizCoupon(data) {
  return requests.post({
    url: '/memberApp/coupon/receive',
    params: data
  })
}
//获取用户卡列表
export function cartList(data) {
  if (data) {
    return requests.get({
      url: '/couponApp/card/list?status=' + data.status,
    })
  } else {
    return requests.get({
      url: '/couponApp/card/list'
    })
  }

}
//获取卡详情
export function getCardDetail(code) {
  return requests.get({
    url: '/couponApp/card/detail?code=' + code,
  })
}
//查询优惠券可用商户及门店
export function getCouponShopList(couponId) {
  return requests.get({
    url: '/couponApp/coupon/verifyShops?couponId=' + couponId,
  })
}
//查询优惠券可用商户及门店
export function getCardShopList(cardId) {
  return requests.get({
    url: '/couponApp/card/verifyShops?cardId=' + cardId,
  })
}
//扫码领取券页面展示信息接口
export function getPrototypeInfo(receiveCode) {
  return requests.get({
    url: '/couponApp/coupon/scanPageInfo?receiveCode=' + receiveCode,
  })
}
//领取优惠券（新）领券中心 扫码领券
export function receiveBizCouponNew(receiveCode) {
  return requests.post({
    url: '/couponApp/coupon/receiveCoupon',
    data: {
      receiveCode
    }
  })
}
//领取优惠券（新）预制领取
export function receiveBizCouponNewPre(couponCode) {
  return requests.post({
    url: '/couponApp/coupon/receive?couponCode=' + couponCode,
  })
}
//释放微信商家券
export function cancelWxBusiCoupon(couponCodes) {
  return requests.post({
    url: '/couponApp/coupon/releaseWxBusiCoupon',
    data: {
      couponCodes
    }
  })
}
//获取领券中心上架券列表
export function getCouponShelfList() {
  return requests.get({
    url: '/couponApp/coupon/shelfList',
  })
}
//根据卡券id获取卡券原型数据
export function getCouponPrototype(prototypeId) {
  return requests.get({
    url: '/couponApp/coupon/prototype?prototypeId=' + prototypeId,
  })
}
//发券前查询是否需要跳转webview获取授权后的openId，
export function payCouponSendQuery(couponIds) {
  return requests.post({
    url: '/couponApp/coupon/payCouponSendQuery',
    data: {
      couponIds

    }
  })
}